package com.googlecode.allinclusive.fw.core.utils;

import com.googlecode.allinclusive.fw.core.config.GlobalConfig;

public class ClassUtils {

	public static final String EXT_PROPERTIES = ".properties";
	
	public static ClassLoader getDefaultClassLoader() {
    	ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    	if (classLoader == null) {
    		classLoader = ClassUtils.class.getClassLoader();
    	}
    	return classLoader;
	}
	
	public static <T> String toProppertiesPath(Class<T> clazz) {
		String className = clazz.getName();
		String propFileName = className.replaceAll("\\.", "/");
		propFileName = propFileName + EXT_PROPERTIES;
		return propFileName;
	}
	
	public static <T> String toSimpleProppertiesPath(Class<T> clazz) {
		return clazz.getSimpleName() + EXT_PROPERTIES;
	}
	
	public static void main(String[] args) {
		System.out.println(toProppertiesPath(GlobalConfig.class));
	}
}
